const path = require('path');
const webpack = require('webpack');
const htmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    entry: {
        vendor: ['babel-polyfill', 'react', 'react-dom']
    },
    output: {
        filename: '[name].dll.js',
        path: path.resolve(__dirname, './build'),
        library: '[name]_lib'
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                use: ['babel-loader'],
                exclude: /node_modules/
            },
            {
                test: /\.styl$/,
                use: [
                    'style-loader',
                    {
                        loader: 'css-loader',
                        options: {
                            modules: true,
                            sourceMap: true,
                            localIdentName: '[name]__[local]--[hash:base64:5]'
                        }
                    },
                    'stylus-loader'
                ]
            }
        ]
    },
    plugins: [
        new webpack.DllPlugin({
            path: path.join(__dirname, 'build/[name]-manifest.json'),
            name: '[name]_lib'
        })
    ]
}
